import { getQueryParams } from '@/utils';
import http from './http';

export default {
  /**
   * @description: 后台登陆
   * @param {type}
   * @return:
   */
  userLogin(data) {
    return http
      .post(`/mall/web/v1/login`, data)
      .dispose_server_error()
      .exec();
  },

  /**
   * TODO A
   * @description: 图片验证码
   * @param {type}
   * @return:
   */
  getImgVerifyCode() {
    return http.post(`/market/mall/backend/v1/captcha`).exec();
  },

  /**
   * @description: 获取手机验证码
   * @param {type}
   * @return:
   */
  sendMobileSms(phone) {
    return http.post(`/market/mall/sms/v1?phone=${phone}`).exec();
  },

  /**
   * @description: 注册的手机验证码
   * @param {type}
   * @return:
   */
  sendMobileSmsByRegister(mobile) {
    return http
      .get(`/market/mall/backend/v1/register/sms/${mobile}`)
      .catch_http_error()
      .dispose_server_error()
      .exec();
  },

  /**
   * TODO D
   * @description: 修改登录密码/
   * @param {type}
   * @return:
   */
  setUserPassword(data, captha) {
    return http
      .post(`/market/mall/merchant/v1/password`, data)
      .setHeaders({
        captha,
      })
      .exec();
  },

  /**
   * @description: 手机号注册商户
   * @param {type}
   * @return:
   */
  register(data) {
    return http.post(`/market/mall/backend/v1/merchant/register`, data).exec();
  },
};
